#ifndef __ILIB_THREAD_MGR_H_20120212__
#define __ILIB_THREAD_MGR_H_20120212__

#include "../../iHeader.h"

class iThread;
class iThreadMgr
{
public:
	enum ThreadType { ORIGINAL, MSG_THREAD, IO_THREAD, TIMER_THREAD, MAX_THREAD_TYPE };
	template<class T> static iThread*  spawn()
	{
		std::list<iThread*> & thd = s_threads[MSG_THREAD];
		T* mt = new T();
		mt->start();
		thd.push_back(mt);
		return mt;
	}
	static iThread* spawn_io(bool def=true);
	static iThread* spawn_timer();
	static iThread* spawn_this();
	static iThread* this_thread();
	static long get_thread_id();
	static long get_process_id();

private:
	static std::vector< std::list<iThread*> > s_threads;
};

#endif  //__ILIB_THREAD_MGR_H_20120212__